package com.tiantian.web.controller.log;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tiantian.bean.PageBean;
import com.tiantian.domain.Backstagelog;
import com.tiantian.service.BackstagelogService;
import com.tiantian.util.PageUtil;
import com.tiantian.web.datatables.DataTableReturn;

@Controller
@RequestMapping("/log")
public class LogController {
	public static final Logger LOG = LoggerFactory.getLogger(LogController.class);
	@Autowired
	private BackstagelogService backstagelogService;
	
	/**
	 * 后台管理用户列表
	 * 
	 * @param model
	 * @return
	 */
	@RequestMapping(value = { "/index" })
	public String index(Model model) {
		return "log/index";
	}

	@ResponseBody
	@RequestMapping(value = { "/getUserList" })
	public DataTableReturn getLogList(HttpServletRequest request) {
		PageBean page = PageUtil.parseRequest2PageBean(request);
		Map<String, String> params = new HashMap<String, String>();
		List<Backstagelog> data = backstagelogService.list(params, page);
		return new DataTableReturn(page.getDraw(), page.getTotal(), page.getTotal(), data);
	}
}
